Numerous Minor Fixes#4
Open
tjansky-prgs wants to merge 11 commits into
Open
Conversation
added 11 commits
June 16, 2026 15:11
PacketInfo members and DecidePort() parameter used the elaborated-type- specifier 'enum Foo' for types declared as 'enum class Foo'. While many compilers accept this, mixing the two forms is non-conforming per the C++ standard and can fail with stricter compiler settings. Replace with the plain type name directly.
DecidePort() returns 0 when source and destination IP addresses are equal (or when parsing fails). The previous check 'result < 0' mapped this case to Interface1, making the assignment non-deterministic and asymmetric. Changing to '<= 0' ensures equal addresses always go to Interface0, providing a stable deterministic default.
std::runtime_error was constructed but immediately discarded without being thrown. When the histogram has not been initialized the function silently continued, leading to undefined behaviour on the empty vector access below. Add the missing 'throw' keyword.
The loop condition 'windowIndex <= end_window_idx / WINDOW_SIZE + 1' allowed windowIndex to reach nOfWindows when end_window_idx was the last valid bin, which is one past the end of windowsAcc (size nOfWindows). The spurious '+ 1' served no purpose since the inner body already guards the write via 'if (pkts > 0)' and GetHistogramBin() returns 0 for out-of-range indices. Remove the '+ 1' to keep the loop strictly within bounds.
CreateInitialPopulation() called fut.wait() on the worker futures, which blocks until completion but silently discards any stored exception. If a worker throws, the population is left in an incomplete state and UpdateFitnessStats() runs on bad data. Switching to fut.get() re-throws the stored exception to the caller.
…Worker() std::uniform_int_distribution<uint64_t>(0, profileSize) is inclusive on both ends, so it can generate an index equal to profileSize. Since genotype has size profileSize (valid indices 0..profileSize-1), this is an out-of-bounds access causing undefined behaviour. Change the upper bound to profileSize - 1.
The 'bidir' member had no default initializer, so default-constructing SMSubnetSegment (e.g. from pybind11 py::init<>()) left it with an indeterminate value. Contains() reads bidir unconditionally, resulting in undefined behaviour. Initialize to 'false' (unidirectional) as the safe default.
sysconfig.get_path("stdlib") returns the standard library directory
(e.g. /usr/lib/python3.9), not the site-packages directory. The path
was then extended with a hardcoded "/site-packages/flowtest" suffix
which accidentally worked on some layouts but is not guaranteed.
Use sysconfig.get_path("platlib") which directly returns the compiled
extension modules site-packages directory, and os.path.join() for
safe path construction.
ParseSpeedUnit() applied 'multiplier * 8' before returning, turning e.g. '100 gbps' into 800e9 instead of the correct 100e9 bits/sec. Since gbps/mbps/kbps/bps units are already in bits per second, the extra factor of 8 was wrong and inconsistent with the default _linkSpeedBps value of 100e9 (100 Gbps). Remove the '* 8' so the function returns the correct bits-per-second value.
…ead of sum The C++ implementation (CalcMinGlobalPacketGapPicos) computes the minimum inter-packet gap as the wire transfer time PLUS the configured min_packet_gap: 'minGap = transferTime + minPacketGapNanos'. The Python test helper incorrectly returned min(transfer_nanos, min_packet_gap_ns), which can be smaller than the actual minimum gap enforced by the code. This made the test weaker than intended and could mask regressions. Change to use the sum to match the implementation.
rte_eth_dev_set_mtu() and the devInfo min/max_mtu validation both operate on the L3 payload MTU (e.g. 1500 for standard Ethernet), but _MTUSize (default 1518) represents the full Ethernet frame size including the 14-byte header and 4-byte FCS. Passing the frame size directly caused an 18-byte discrepancy. Define ETH_OVERHEAD = 18 and subtract it when calling rte_eth_dev_set_mtu() and when comparing against devInfo min/max_mtu.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.